# Guess, Andrew and Alexander Coppock. Does Counter-Attitudinal Information Cause Backlash? Results from Three Large Survey Experiments. British Journal of Political Science, forthcoming.

# Produdes Tables 15, 16, 17, and 18 in the Appendix

rm(list = ls())
library(tidyverse)
library(reshape2)
library(estimatr)
library(stargazer)
library(xtable)

# Alternative specifications
load("GC_Study_2.rdata")
load("GC_Study_3.rdata")

# Appendix Tables: Table 15 -----------------------------------------------

fit_1 <- lm(amount_T2 ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0), data = subset(study_2, initial_position == "con_raise"))
fit_2 <- lm(amount_T2 ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0) + favor_T1_recode + age + male + ideology + partyid + education + amount_T1,
            data = subset(study_2, initial_position == "con_raise"))

fit_3 <- lm(amount_T2 ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0), 
            data = subset(study_2, initial_position == "inconsistent_raise"))
fit_4 <- lm(amount_T2 ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0) + favor_T1_recode + age + male + ideology + partyid + education + amount_T1,
            data = subset(study_2, initial_position == "inconsistent_raise"))

fit_5 <- lm(amount_T2 ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0), 
            data = subset(study_2, initial_position == "pro_raise"))
fit_6 <- lm(amount_T2 ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0) + favor_T1_recode + age +  male + ideology + partyid + education + amount_T1,
            data = subset(study_2, initial_position == "pro_raise"))

stargazer(fit_1, fit_2, fit_3, fit_4, fit_5, fit_6, 
          se=starprep(fit_1, fit_2, fit_3, fit_4, fit_5, fit_6),
          p=fix_ps(fit_1, fit_2, fit_3, fit_4, fit_5, fit_6),
          style="apsr", column.sep.width = "0pt",  digits=2,
          omit=c("amount|age|male|ideology|educ|race|party|favor"), omit.labels=c("Covariates"),
          omit.stat=c("adj.rsq", "f", "ser"),
          column.labels =c("Among Opponents","Among Moderates","Among Proponents"),
          column.separate = c(2,2,2),
          dep.var.labels="Dependent Variable: T2 Amount",
          covariate.labels=c("Pos. Info (0 to 1)", "Neg. Info (0 to 1)", "Condition: Pro/Con", "Constant"),
          model.numbers=FALSE,
          notes=c("Robust standard errors are in parentheses.",
                  "The information content of the Pro/Con condition is coded 0.",
                  "Covariates include T1 Amount, T1 Favor, age, gender, ideology, party ID, and education."),
          font.size="small",float=FALSE)


# Appendix Tables: Table 16 ------------------------------------------------

fit_7 <- lm(favor_T2_recode ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0), 
            data = subset(study_2, initial_position == "con_raise"))
fit_8 <- lm(favor_T2_recode ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0) + favor_T1_recode +
              age + male + ideology + partyid + education + amount_T1,
            data = subset(study_2, initial_position == "con_raise"))

fit_9 <- lm(favor_T2_recode ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0), 
            data = subset(study_2, initial_position == "inconsistent_raise"))
fit_10 <- lm(favor_T2_recode ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0) + favor_T1_recode +
               age + male + ideology + partyid + education + amount_T1,
             data = subset(study_2, initial_position == "inconsistent_raise"))

fit_11 <- lm(favor_T2_recode ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0), 
             data = subset(study_2, initial_position == "pro_raise"))
fit_12 <- lm(favor_T2_recode ~ positive_information + negative_information + (condition_type!="Placebo" & positive_information == 0 & negative_information == 0) + favor_T1_recode +
               age +  male + ideology + partyid + education + amount_T1,
             data = subset(study_2, initial_position == "pro_raise"))


stargazer(fit_7, fit_8, fit_9, fit_10, fit_11, fit_12, 
          se=starprep(fit_7, fit_8, fit_9, fit_10, fit_11, fit_12),
          p=fix_ps(fit_7, fit_8, fit_9, fit_10, fit_11, fit_12),
          style="apsr", column.sep.width = "0pt",  digits=2,
          omit=c("amount|age|male|ideology|educ|race|party|favor"), omit.labels=c("Covariates"),
          omit.stat=c("adj.rsq", "f", "ser"),
          column.labels =c("Among Opponents","Among Moderates","Among Proponents"),
          column.separate = c(2,2,2),
          dep.var.labels="Dependent Variable: T2 Favor",
          covariate.labels=c("Pos. Info (0 to 1)", "Neg. Info (0 to 1)", "Condition: Pro/Con", "Constant"),
          model.numbers=FALSE,
          notes=c("Robust standard errors are in parentheses.",
                  "The information content of the Pro/Con condition is coded 0.",
                  "Covariates include T1 Amount, T1 Favor, age, gender, ideology, party ID, and education."),
          font.size="small",float=FALSE)



# Appendix Tables: Table 17 -------------------------------------------------------

fit_1 <- lm(support_recode_T2 ~ positive_information + negative_information + (condition_factor=="PC"), data=subset(study_3, pro==1))
fit_2 <- lm(support_recode_T2 ~ positive_information + negative_information + (condition_factor=="PC") + support_recode_T1 + deter_recode_T1 + age + female + ideology + educ + race, data=subset(study_3, pro==1))
fit_3 <- lm(support_recode_T2 ~ positive_information + negative_information + (condition_factor=="PC"), data=subset(study_3, pro==0))
fit_4 <- lm(support_recode_T2 ~ positive_information + negative_information + (condition_factor=="PC")+ support_recode_T1 + deter_recode_T1 + age + female + ideology + educ + race, data=subset(study_3, pro==0))

fit_5 <- lm(deter_recode_T2 ~ positive_information + negative_information + (condition_factor=="PC"), data=subset(study_3, pro==1))
fit_6 <- lm(deter_recode_T2 ~ positive_information + negative_information + (condition_factor=="PC")+ support_recode_T1 + deter_recode_T1 + age + female + ideology + educ + race, data=subset(study_3, pro==1))
fit_7 <- lm(deter_recode_T2 ~ positive_information + negative_information + (condition_factor=="PC"), data=subset(study_3, pro==0))
fit_8 <- lm(deter_recode_T2 ~ positive_information + negative_information + (condition_factor=="PC")+ support_recode_T1 + deter_recode_T1 + age + female + ideology + educ + race, data=subset(study_3, pro==0))

stargazer(fit_1, fit_2, fit_3, fit_4, 
          se=starprep(fit_1, fit_2, fit_3, fit_4),
          p=fix_ps(fit_1, fit_2, fit_3, fit_4),
          style="apsr", column.sep.width = "0pt",  digits=2,
          omit=c("(support_recode_T1|deter_recode_T1|age|female|ideology|educ|race)"), omit.labels=c("Covariates"),
          omit.stat=c("adj.rsq", "f", "ser"),
          column.labels =c("Among Proponents", "Among Opponents"),
          column.separate = c(2,2),
          dep.var.labels="Dependent Variable: T2 Attitude Toward Capital Punishment",
          covariate.labels=c("Positive Information (0 to 2)", "Negative Information (0 to 2)", 
                             "Condition: Pro/Con", "Constant"),
          align=TRUE,model.numbers=FALSE,
          notes=c("Robust standard errors are in parentheses.",
                  "The information content of the Pro/Con condition is coded 0.",
                  "Covariates include T1 Attitude, T1 Belief, age, gender, ideology, race, and education."),
          font.size="small",label="tab: dosagesupport",float=FALSE)



# Appendix Tables: Table 18 -------------------------------------------------------

stargazer(fit_5, fit_6, fit_7, fit_8, 
          se=starprep(fit_5, fit_6, fit_7, fit_8),
          p=fix_ps(fit_5, fit_6, fit_7, fit_8),
          style="apsr", column.sep.width = "0pt",  digits=2,
          omit=c("support_recode_T1|deter_recode_T1|age|female|ideology|educ|race") , omit.labels=c("Covariates"),
          omit.stat=c("adj.rsq", "f", "ser"),
          column.labels =c("Among Proponents", "Among Opponents"),
          column.separate = c(2,2),
          dep.var.labels="Dependent Variable: T2 Belief in Deterrent Effect",
          covariate.labels=c("Positive Information (0 to 2)", "Negative Information (0 to 2)", 
                             "Condition: Pro/Con", "Constant"),
          align=TRUE,model.numbers=FALSE,
          notes=c("Robust standard errors are in parentheses.",
                  "The information content of the Pro/Con condition is coded 0.",
                  "Covariates include T1 Attitude, T1 Belief, age, gender, ideology, race, and education."),
          font.size="small",float=FALSE)

